FROM node:10-alpine
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
	&& apk add --no-cache nginx

RUN npm install -g cnpm --registry=https://registry.npm.taobao.org

COPY package.json /tmp/package.json
COPY package-lock.json /tmp/package-lock.json
RUN cd /tmp && npm install
RUN mkdir -p /app && cp -a /tmp/node_modules /app/


COPY docker_build/nginx/nginx.conf /etc/nginx/nginx.conf
COPY docker_build/nginx/default.conf /etc/nginx/conf.d/default.conf

WORKDIR /app

COPY . .

RUN npm run build

COPY docker-entrypoint.sh /
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]

EXPOSE 80